package com.zhengshang.common.pay.alipay;

import com.alibaba.fastjson.JSONObject;
import com.alipay.api.*;
import com.alipay.api.domain.AlipayTradeAppPayModel;
import com.alipay.api.domain.AlipayTradeCloseModel;
import com.alipay.api.domain.AlipayTradeRefundModel;
import com.alipay.api.internal.util.AlipaySignature;
import com.alipay.api.request.AlipayTradeAppPayRequest;
import com.alipay.api.request.AlipayTradeCloseRequest;
import com.alipay.api.request.AlipayTradeRefundRequest;
import com.alipay.api.response.AlipayTradeAppPayResponse;
import com.alipay.api.response.AlipayTradeCloseResponse;
import com.alipay.api.response.AlipayTradeRefundResponse;
import com.zhengshang.common.constant.CommonConstants;
import com.zhengshang.common.constant.app.AppConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

/**
 * @author HY
 * @version 1.0.0
 * @ClassName AlipayConstant.java
 * @Description TODO
 * @createTime 2021年03月20日 16:14
 */
@Component
public class AlipayService {






    protected final Logger logger = LoggerFactory.getLogger(AlipayService.class);

    public static final String CHARSET = "utf-8";//编码格式
    public static final String SIGN_TYPE = "RSA2";//签名方式

    //测试数据
//    public final String APP_ID = "2021000117625415";
//    public final String APP_PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCK0dRANLcPbRKmzvR7FZZOsoTdDdyEzdKM8MhoaYwwFXvDchlhwJ10/zztWyRY5xhUewoT9MoQ6nVvjqwIkCe1k9RqES0VYdxLwjJDIYWeovi9tmSWF9dmJRDFbkUGWrK/uT5/5g4utcrrMtw6FXWTgmjG0PpsATgmRBQPEkogQix4lwuhBThLM2i8h0Ye4L2DEf2O+QHGEvKlb/O9v5sJxOlo+gC7LbW3d84/2RddsfD8IebgFACSk1FDBw9Py5WBmTrxvXgzmOCGdJhc5ftFNpiy4TgsOdnv6L0Lky3b3D9ClDSv3PmtES8VF5/A4YVlN4UeAn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1WADLeTsYA0UnBvftoXQaqobLV0q829/s5P52UBjnOed2j6LE0e/raAUxCJb/QW23VJ/l2Jv2hJx2WWKOxTnzwJuiQ0vnVxt2q0ovSraTju0S323neSbDTW7J9Civ+44Ko3P3z0jHW8yF6V/BRu4T05VA=";
//    public final String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAitHUQDS3D20Sps70exWWTrKE3Q3chM3SjPDIaGmMMBV7w3IZYcCddP887VskWOcYVHsKE/TKEOp1b46sCJAntZPUahEtFWHcS8IyQyGFnqL4vbZklhfXZiUQxW5FBlqyv7k+f+YOLrXK6zLcOhV1k4JoxtD6bAE4JkQUDxJKIEIseJcLoQU4SzNovIdGHuC9gxH9jvkBxhLypW/zvb+bCcTpaPoAuy21t3fOP9kXXbHw/CHm4BQAkpNRQwcPT8uVgZk68b14M5jghnSYXOX7RTaYsuE4LDnZ7+i9C5Mt29w/QpQ0r9z5rREvFRefwOGFZTeFHgJ7MJXJYpu3p8+V3QIDAQAB";
//    public final String NOTIFY_URL = "https://www.youhuiniuapp.com/api/alipay/gateway";

    //正式数据
    private final String APP_ID = "2021002132686077";
    private final String APP_PRIVATE_KEY = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCPP6sckD/9VPwihYIF3RI0K3pvDm4WqvhTOxH6EnkG4rYn4LLqeF98uNnYSdTJVKqr5rdomlD3zGjIv9dO8ai70z2pc+GhqVUN22r7QdmVE7SsCg4ot5cwUeFcSUBkMgjf6lafnflbvmeNi4yX/sugqamvBiL0IMsKyvE7tem3uHNuLrn2G4ydF9MxilBhI+PGYvSOsn6uFNd/DITwpvdmdD3HZHKEp9qW6MWjFQ4my7pTmusn0dXkXLrpdy2tN1OrocOzFEAQaWk3a91pHB/aVK1VOqGwJW12XEjeE6RyY2EDacsv10mAa3b9UKisX3jHHvetQMF0K9N1olpBYu+DAgMBAAECggEAZpkIWjXqzuv+hk8vG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gP6bBjTCDoxcDQARYVBAQxezwJVGVl05lWB0X9+1JOe9G7F0PVQ9m9ck10HwkQ2h6jVWBmdj8lG/xPDsIjH1PdzmUtQwoUVpseDMDyoXoeejIRPK5ShMWcWGfi6Ed9Q==";
    private final String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzqWJM8oGHqEkUXnE31E7tJhaT6/UrUlMwc65wonbcN5iLTFZ3ujPn7lHOJUWebXf0EKpAls2+3S24nM23i9YjgmwQiAr6BOIH3+U28zALryhsWKxG4vujz5nKmQtOEi72CGk79cNygiRPOruTzkGuW1OqmDllmCjsbDb8wCt0WMmK2AMk4PNduX+Sa6RcQcqnXL+TMZjndBuUIU3IG5EBMeebp0xxOfy4cQIH4jGPZ/Wu2hEeU5vLiJ8pY8JLe7uiBw7KyetvHoRaV8c66r3L2miNpWSC5nuSH8DyC5AtSUqtfMplx6HsY5oADAjpvGidbcc6QObjPaJdMKE8rZatwIDAQAB";

//    //实例化客户端
//    private AlipayClient alipayClient = new DefaultAlipayClient(ALIPAY_GATEWAY_URL, APP_ID, APP_PRIVATE_KEY, "json", CHARSET, ALIPAY_PUBLIC_KEY, SIGN_TYPE);
//    //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称：alipay.trade.app.pay
//    private AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();

//    /**
//     * @title 获取签名
//     * @description
//     * @author admin
//     * @updateTime 2021/3/25 16:41
//     * @throws
//     */
//    public String getSign(String body, String title, String totalAmount, String orderNum, String notifyUrl) {
//
//        //SDK已经封装掉了公共参数，这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。
//        AlipayTradeAppPayModel model = new AlipayTradeAppPayModel();
//        model.setBody(body);//对一笔交易的具体描述信息。如果是多种商品，请将商品描述字符串累加传给body
//        model.setSubject(title);//商品的标题/交易标题/订单标题/订单关键字等
//        model.setTotalAmount(totalAmount);//订单总金额，单位为元，精确到小数点后两位，取值范围[0.01,100000000]
//        model.setProductCode("FACE_TO_FACE_PAYMENT");//销售产品码，商家和支付宝签约的产品码
//        model.setOutTradeNo(orderNum);//商户网站唯一订单号，请保证OutTradeNo值每次保证唯一
//        model.setTimeoutExpress("30m");//该笔订单允许的最晚付款时间，逾期将关闭交易。取值范围：1m～15d。m-分钟，h-小时，d-天，1c-当天（1c-当天的情况下，无论交易何时创建，都在0点关闭）。 该参数数值不接受小数点， 如 1.5h，可转换为 90m。
//        request.setBizModel(model);
//        request.setNotifyUrl(notifyUrl);//商户外网可以访问的异步地址
//        AlipayTradeAppPayResponse response;
//        try {
//            response = alipayClient.sdkExecute(request);//这里和普通的接口调用不同，使用的是sdkExecute
//            System.out.println(response.getBody());
//            return response.getBody();
//        } catch (AlipayApiException e) {
//            e.printStackTrace();
//            String massage = "alipay.trade.app.pay接口：订单签名错误";
//            System.out.println(massage);
//        }
//        return null;
//    }

    /**
     * @title 生成 APP 支付订单信息（证书）
     * @description
     * @author admin
     * @updateTime 2021/3/25 19:16
     * @throws
     */
    public String getCertificateSign(String body, String title, String totalAmount, String orderNum, String notifyUrl) throws AlipayApiException {
        //构造client
        CertAlipayRequest certAlipayRequest = new CertAlipayRequest();
        //设置网关地址
        certAlipayRequest.setServerUrl(AppConstant.ALIPAY_SERVER_URL);
        //设置应用Id
        certAlipayRequest.setAppId(APP_ID);
        //设置应用私钥
        certAlipayRequest.setPrivateKey(APP_PRIVATE_KEY);
        //设置请求格式，固定值json
        certAlipayRequest.setFormat("json");
        //设置字符集
        certAlipayRequest.setCharset(CHARSET);
        //设置签名类型
        certAlipayRequest.setSignType(SIGN_TYPE);
        //设置应用公钥证书路径
        certAlipayRequest.setCertPath(CommonConstants.getAppCertPath());
        //设置支付宝公钥证书路径
        certAlipayRequest.setAlipayPublicCertPath(CommonConstants.getAlipayCertPath());
        //设置支付宝根证书路径
        certAlipayRequest.setRootCertPath(CommonConstants.getAlipayRootCert());
        //构造client
        AlipayClient alipayClient = new DefaultAlipayClient(certAlipayRequest);

        //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称：alipay.trade.app.pay
        AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
        //SDK已经封装掉了公共参数，这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。
        AlipayTradeAppPayModel model = new AlipayTradeAppPayModel();
        model.setBody(body);
        model.setSubject(title);
        model.setOutTradeNo(orderNum);
        model.setTimeoutExpress(AppConstant.PAY_ORDER_OVERTIME_ALIPAY);
        model.setTotalAmount(totalAmount);
        model.setProductCode("FACE_TO_FACE_PAYMENT");
        request.setBizModel(model);
        request.setNotifyUrl(notifyUrl);
        //这里和普通的接口调用不同，使用的是sdkExecute
        AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request);
//        System.out.println(response.getBody()); //就是orderString可以直接给客户端请求，无需再做处理。
        return response.getBody();
    }

    /**
     * @title 验证异步通知信息
     * @description 
     * @author admin 
     * @updateTime 2021/3/29 9:43 
     * @throws
     */
    public Map<String, String> asyn(HttpServletRequest request) throws AlipayApiException {
        //获取支付宝POST过来反馈信息
        Map<String, String> params = new HashMap<String, String>();
        Map requestParams = request.getParameterMap();
        String data = "";
        for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext(); ) {
            String name = (String) iter.next();
            String[] values = (String[]) requestParams.get(name);
            String valueStr = "";
            for (int i = 0; i < values.length; i++) {
                valueStr = (i == values.length - 1) ? valueStr + values[i]
                        : valueStr + values[i] + ",";
            }
            //乱码解决，这段代码在出现乱码时使用。
            //valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8");
            params.put(name, valueStr);
            data += name + "=" + valueStr + "&";
            logger.info("alipayService<key=value>：" + name + "=" + valueStr);
        }
        //切记alipaypublickey是支付宝的公钥，请去open.alipay.com对应应用下查看。
        //boolean AlipaySignature.rsaCertCheckV1(Map<String, String> params, String publicKeyCertPath, String charset,String signType)
        boolean isOK = AlipaySignature.rsaCertCheckV1(params, CommonConstants.getAlipayCertPath(), CHARSET, SIGN_TYPE);
        if (isOK) {
            params.put("data", data);
            return params;
        }
        throw new AlipayApiException("回调结果异常");
//        return isOK;
    }

    /**
     * @title 交易关闭
     * @description 
     * @author admin 
     * @updateTime 2021/3/29 14:03 
     * @throws
     */
    public boolean closeOrder(String orderNum) throws AlipayApiException {

        //构造client
        CertAlipayRequest certAlipayRequest = new CertAlipayRequest();
        //设置网关地址
        certAlipayRequest.setServerUrl(AppConstant.ALIPAY_SERVER_URL);
        //设置应用Id
        certAlipayRequest.setAppId(APP_ID);
        //设置应用私钥
        certAlipayRequest.setPrivateKey(APP_PRIVATE_KEY);
        //设置请求格式，固定值json
        certAlipayRequest.setFormat("json");
        //设置字符集
        certAlipayRequest.setCharset(CHARSET);
        //设置签名类型
        certAlipayRequest.setSignType(SIGN_TYPE);
        //设置应用公钥证书路径
        certAlipayRequest.setCertPath(CommonConstants.getAppCertPath());
        //设置支付宝公钥证书路径
        certAlipayRequest.setAlipayPublicCertPath(CommonConstants.getAlipayCertPath());
        //设置支付宝根证书路径
        certAlipayRequest.setRootCertPath(CommonConstants.getAlipayRootCert());
        //构造client
        AlipayClient alipayClient = new DefaultAlipayClient(certAlipayRequest);

        /** 实例化具体API对应的request类，类名称和接口名称对应,当前调用接口名称： alipay.trade.close（统一收单交易关闭接口） **/
        AlipayTradeCloseRequest request = new AlipayTradeCloseRequest();

        /** 设置业务参数 **/
        AlipayTradeCloseModel model = new AlipayTradeCloseModel();

        /** 注：交易号（TradeNo）与订单号（OutTradeNo）二选一传入即可，如果2个同时传入，则以交易号为准 **/
        /** 支付接口传入的商户订单号。如：2020061601290011200000140004 **/
        model.setOutTradeNo(orderNum);

        /** 异步通知/查询接口返回的支付宝交易号，如：2020061622001473951448314322 **/
        //model.setTradeNo("2020061622001473951448314322");

        /** 将业务参数传至request中 **/
        request.setBizModel(model);

        /** 第三方调用（服务商模式），必须传值与支付接口相同的app_auth_token **/
        //request.putOtherTextParam("app_auth_token", "传入获取到的app_auth_token值");

        AlipayTradeCloseResponse response = null;
        try {

            /** 通过alipayClient调用API，获得对应的response类  **/
            response = alipayClient.execute(request);
        } catch (AlipayApiException e) {
            e.printStackTrace();
        }

        /** 获取接口调用结果，如果调用失败，可根据返回错误信息到该文档寻找排查方案：https://opensupport.alipay.com/support/helpcenter/101 **/
//        System.out.println(response.getBody());
        if (response != null && response.isSuccess()) {
            String result = response.getBody();
            JSONObject resultObj = JSONObject.parseObject(result);
            JSONObject dataObj = resultObj.getJSONObject("alipay_trade_close_response");
            if ("10000".equals(dataObj.getString("code"))) {
                //成功
                logger.info("支付宝关闭订单<" + orderNum + ">成功");
                return true;
            } else {
                //失败
                logger.info("支付宝关闭订单<" + orderNum + ">失败，" + dataObj.getString("sub_msg"));
                return false;
            }
        }
        return false;
    }

    /**
     * @title 校验签名
     * @description 
     * @author admin 
     * @updateTime 2021/3/25 16:44 
     * @throws
     */
    public boolean verifySign(HttpServletRequest request){
        StringBuffer sb = new StringBuffer();
        //获取支付宝POST过来反馈信息
        Map<String, String> params  =  new HashMap<String, String>();
        Map requestParams = request.getParameterMap();
        for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext();) {
            String name = (String) iter.next();
            String[] values = ( String[]) requestParams.get(name);
            String valueStr = "";
            for (int i = 0; i < values.length; i++) {
                valueStr = (i == values.length - 1) ? valueStr + values[i] : valueStr + values[i] + ",";
            }
            //乱码解决，这段代码在出现乱码时使用。
            //valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8");
            params.put(name, valueStr);
            sb.append("key=" + name + "&value=" + valueStr + ",");
        }
        logger.info("<verifySign>验签结果：" + sb.toString());
        try {
            boolean flag = AlipaySignature.rsaCheckV1(params, ALIPAY_PUBLIC_KEY, CHARSET, "RSA2");
            return flag;
        } catch (AlipayApiException e) {
            e.printStackTrace();
            return false;
        }
    }

    /**
     *
     * 说明： 支付宝订单退款
     * @param out_trade_no  订单编号
     * @param refund_amount 退款金额 不得大于订单金额
     * @param refund_reason 退款说明
     * @param out_request_no 标识一次退款请求，同一笔交易多次退款需要保证唯一，如需部分退款，则此参数必传。
     * @return  公共返回参数 code,msg,   响应参数实例: https://docs.open.alipay.com/api_1/alipay.trade.refund
     * @author ArLen
     * @time：2018年12月11日 下午2:29:13
     */
    public String alipayRefund(String out_trade_no,
                               String refund_amount,
                               String refund_reason,
                               String out_request_no) {

        try {
            //构造client
            CertAlipayRequest certAlipayRequest = new CertAlipayRequest();
            //设置网关地址
            certAlipayRequest.setServerUrl(AppConstant.ALIPAY_SERVER_URL);
            //设置应用Id
            certAlipayRequest.setAppId(APP_ID);
            //设置应用私钥
            certAlipayRequest.setPrivateKey(APP_PRIVATE_KEY);
            //设置请求格式，固定值json
            certAlipayRequest.setFormat("json");
            //设置字符集
            certAlipayRequest.setCharset(CHARSET);
            //设置签名类型
            certAlipayRequest.setSignType(SIGN_TYPE);
            //设置应用公钥证书路径
            certAlipayRequest.setCertPath(CommonConstants.getAppCertPath());
            //设置支付宝公钥证书路径
            certAlipayRequest.setAlipayPublicCertPath(CommonConstants.getAlipayCertPath());
            //设置支付宝根证书路径
            certAlipayRequest.setRootCertPath(CommonConstants.getAlipayRootCert());
            //构造client
            AlipayClient alipayClient = new DefaultAlipayClient(certAlipayRequest);
            logger.info(alipayClient == null ? "构造client失败" : "不是空的");
            logger.info(alipayClient.toString());

            //订单编号   支付宝交易号不为空
            if(out_trade_no!=null) {

                AlipayTradeRefundRequest alipay_request = new AlipayTradeRefundRequest();
                AlipayTradeRefundModel model=new AlipayTradeRefundModel();
                model.setOutTradeNo(out_trade_no);
//                model.setTradeNo(trade_no);
                model.setRefundAmount(refund_amount);
                model.setRefundReason(refund_reason);
                model.setOutRequestNo(out_request_no);
                alipay_request.setBizModel(model);

                AlipayTradeRefundResponse alipay_response = alipayClient.certificateExecute(alipay_request);
                String alipayRefundStr = alipay_response.getBody();
//                System.out.println(alipayRefundStr);
                return alipayRefundStr;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

}
